package com.qualitair44.data;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.jsoup.select.Elements;

import android.util.Log;

public class Mesure {

	private int NO2;
	private int S02;
	private int O3;
	private int PS;
	private Date date;
	private int indice;
	public Mesure(Date date, int indice) {
		super();
		this.date = date;
		this.indice = indice;
	}
	
	
	public Mesure(Elements e){
		SimpleDateFormat SDF = new SimpleDateFormat("dd/MM/yyyy");
		try {
			this.date = SDF.parse(e.get(1).html());
		} catch (ParseException e1) {
			Log.e("Qualitair", "Erreur de pattern sur la date");
		}
		indice = Integer.parseInt(e.get(2).html());
		NO2 = Integer.parseInt(e.get(3).html());
		S02 = Integer.parseInt(e.get(4).html());
		O3 = Integer.parseInt(e.get(5).html());
		PS = Integer.parseInt(e.get(6).html());
	}
	/**
	 * @return the date
	 */
	public Date getDate() {
		return date;
	}
	/**
	 * @param date the date to set
	 */
	public void setDate(Date date) {
		this.date = date;
	}
	/**
	 * @return the indice
	 */
	public int getIndice() {
		return indice;
	}
	/**
	 * @param indice the indice to set
	 */
	public void setIndice(int indice) {
		this.indice = indice;
	}
	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "Mesure [NO2=" + NO2 + ", S02=" + S02 + ", O3=" + O3 + ", PS="
				+ PS + ", date=" + date + ", indice=" + indice + "]";
	}
	/**
	 * @return the nO2
	 */
	public int getNO2() {
		return NO2;
	}
	/**
	 * @param nO2 the nO2 to set
	 */
	public void setNO2(int nO2) {
		NO2 = nO2;
	}
	/**
	 * @return the o3
	 */
	public int getO3() {
		return O3;
	}
	/**
	 * @param o3 the o3 to set
	 */
	public void setO3(int o3) {
		O3 = o3;
	}
	/**
	 * @return the pS
	 */
	public int getPS() {
		return PS;
	}
	/**
	 * @param pS the pS to set
	 */
	public void setPS(int pS) {
		PS = pS;
	}


	/**
	 * @return the s02
	 */
	public int getS02() {
		return S02;
	}


	/**
	 * @param s02 the s02 to set
	 */
	public void setS02(int s02) {
		S02 = s02;
	}
	
}
